Repository navigation
feat: support NestJS 12 - #312
Merged
Merged
Conversation
- Widen the optional @nestjs/terminus dependency from a pinned 11.1.1 to ^11.1.1 || ^12.1.0. Terminus 11 only accepts @nestjs/common ^10 || ^11, so npm reported ERESOLVE peer conflicts on NestJS 12 apps. A range also lets npm dedupe with the app's own Terminus. - Import ModuleMetadata and Type from @nestjs/common instead of the deep @nestjs/common/interfaces path, which NestJS 12's exports map no longer resolves. - Develop and test against NestJS 12 (now ESM-only). The library stays CommonJS and loads it through require(esm); Jest runs with --experimental-vm-modules for the same reason. - CI runs the unit tests against NestJS 12 + Terminus 12, NestJS 11 + Terminus 12 and NestJS 11 + Terminus 11. - Move the samples to NestJS 12 and document the supported combinations. Closes #310
The library type-checked only because ioredis 5 pulled in @types/node transitively. ioredis 6 no longer does, so TypeScript fell back to an unrelated @types/node@12 and failed on the NestJS 12 and Terminus typings. Add @types/node as a direct dev dependency and list it in types. ioredis 6 is already allowed by the >=5.0.0 peer range; CI now builds and tests against it as well (NestJS 12 + Terminus 12).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #310.
The problem
@nestjs/terminuswas pinned to11.1.1inoptionalDependencies, so npm always installs it. Terminus 11 declares@nestjs/common ^10 || ^11as a peer, so on a NestJS 12 app npm reportsERESOLVE overriding peer dependencyand installs Terminus 11 against Nest 12.On top of that, NestJS 12 and Terminus 12 are ESM-only (
"type": "module"), while this library is published as CommonJS.Changes
@nestjs/terminus:11.1.1→^11.1.1 || ^12.1.0(still inoptionalDependencies, so nothing changes for anyone who didn't install it). Terminus 12 accepts@nestjs/common ^11 || ^12, and the range lets npm dedupe with the app's own Terminus.import { ModuleMetadata, Type } from '@nestjs/common'instead of@nestjs/common/interfaces: NestJS 12'sexportsmap no longer resolves that path. Both versions export those types from the root.require(esm)(20.19+, 22.12+, 24+, the sameenginesTerminus 12 declares). Tested from both CJS and ESM apps.--experimental-vm-modulestorequireESM packages, sotestrunsnode --experimental-vm-modules node_modules/jest/bin/jest.js.@types/nodeas a direct dev dependency (types: ["node", "jest"]): type-checking only worked because ioredis 5 pulled it in transitively. With ioredis 6 (already allowed by the>=5.0.0peer) TypeScript fell back to@types/node@12and failed on the NestJS 12 typings.@nestjs/cli12.0.8,@nestjs/schematics12.0.6).CLAUDE.mdupdated.peerDependencies(>=6.7.0) are unchanged: they already allowed Nest 12.Verification
Unit tests at 100% in all three combinations (run locally):
Clean npm consumer (
@nestjs/common@12 @nestjs/core@12 ioredis@5+ the package):npm install2.2.2ERESOLVE overriding peer dependency×2Also passing:
pnpm check,tsc --noEmit, build and tests for the library and samples, sample e2e tests,docusaurus build,pnpm install --frozen-lockfile.pnpm auditis unchanged from #311 (2 dev findings with no upstream patch).